package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum PurchasePaymentStatusEnum {
    /**
     * 订单支付状态(0.未支付,1.已支付,2.待退款,3.已退款)
     */
    PAYMENT_STATUS_UNPAY(0, "未支付"),
    PAYMENT_STATUS_PAY(1, "已支付"),
    PAYMENT_STATUS_WAIT_REFUND(2, "待退款"),
    PAYMENT_STATUS_REFUND(3, "已退款");

    private Integer id;
    private String name;

    PurchasePaymentStatusEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        PurchasePaymentStatusEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static PurchasePaymentStatusEnum getById(Integer id) {
        for (PurchasePaymentStatusEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

}
